new Vue({
    el: '#bankopenmain',
    data: () => ({
        banklist: [],
        banks_id: '',//银行id
        bankname: '',
        account_name: '',
        account_num: '',
        is_main: '0',
        repeat: true
    }),
    mounted(){
        $.ajax({
            url: '/admin/customer/' + $('#bank').val(),
            data: {
                getbank: '',
                bankid: $('#bankid').val(),
                country_id: $('#country_id').val()
            },
            type: 'post',
            success: (data) => {
                data = JSON.parse(data)
                if (data.info) {
                    this.banks_id = data.info.banks_id
                    this.bankname = data.info.bankname
                    this.account_name = data.info.account_name
                    this.account_num = data.info.account_num
                    this.is_main = data.info.is_main
                }
                this.banklist = data.getmethods
            }
        })
    },
    methods: {
        savefun(){
            var data = {
                act: $('#bank').val(),
                banks_id: this.banks_id,//银行id
                bankname: this.bankname,
                account_name: this.account_name,
                account_num: this.account_num,
                is_main: this.is_main ? '1' : '0',
                co_id: $('#company_id').val(),//公司id
                id: $('#bankid').val(),//账号id
            }
            $.ajax({
                url: '/admin/customer/' + $('#bank').val(),
                data,
                type: 'post',
                success: (data) => {
                    data = JSON.parse(data)
                    if (data.status != 1) {
                        change_mes_type('.modal-body .alert',data.status)
                        //toastr.warning(data.msg);
                        $('.modal-body .alert').show()
                        $('.modal-body .alert p').html('*'+data.msg+'<br>')
                    } else {
                        change_mes_type('.alert',data.status)
                        $('.alert').show()
                        $('#bank_Modal').modal('hide')
                        $('.alert p').html('*'+data.msg+'<br>')
                        //toastr.info(data.msg)
                    }
                }
            })
        }
    }
})